/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.knezevic.realestate.beans;

import com.knezevic.realestate.RealEstate;
import com.knezevic.realestate.service.RealEstates;
import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;

/**
 *
 * @author Nemanja
 */
public class RealEstatesServiceBean implements RealEstates{
    private HashMap<Long, RealEstate> realEstates;

    public RealEstatesServiceBean() {
        this(new HashMap<Long, RealEstate>());
    }

    public RealEstatesServiceBean(HashMap<Long, RealEstate> realEstates) {
        super();
        this.realEstates = realEstates;
    }

    public RealEstate save(RealEstate realEstate) {
//        realEstates.put(realEstate.getID(), realEstate);
//        return realEstates.get(realEstate.getID());
        return realEstate;
    }

    public void update(RealEstate realEstate) {
//        realEstates.remove(realEstate.getID());
//        realEstates.put(realEstate.getID(), realEstate);
    }

    public void deleteRealEstate(RealEstate realEstate) {
//        realEstates.remove(realEstate.getID());
    }

    public Collection<RealEstate> retrieve() {
        return realEstates.values();
    }

    public RealEstate retrieve(Serializable id) {
        return realEstates.get(id);
    }


}
